define(function(){
    // 无效果弹窗
    var popup = function(obj, isOnlyOne){
        var _obj = $(obj);
        var isOnlyOne = isOnlyOne || false;
        _obj.show();
        $('body').append('<div class="pop-mask"></div>');
        if(isOnlyOne) return;
        _obj.find('.close,.cancel,.confirm').on('click',function(){
            _obj.hide();
            $('.pop-mask').remove();
        });
    };
    // 向上弹窗
    var popupSlide = function(obj){
        var _obj = $(obj);
        _obj.slideDown(200);
            $('body').append('<div class="pop-mask"></div>');
        _obj.find('.close,.cancel,.cart-sure').on('click',function(){
            _obj.slideUp(200);
            $('.pop-mask').remove();
        });
    };
    //提示弹窗
    var alertPopup = function(txt, isLong){
        var alert_tips ='<div class="alertTips">'+txt+'</div>'; 
        var isLong = isLong || false;
        var speed = isLong  ? 3000 : 1000;
        $('body').append(alert_tips);
        setTimeout(function(){
            $('.alertTips').fadeOut(function(){$(this).remove()});
        },speed);
    };
    //正在处理弹窗
    var loadPopup = function(txt){
        var txt = txt || "正在处理中...";
        var load_tips ='<div class="alert-popup data-progressing" style="display:block;">'; 
        load_tips += '<i class="load-pic"></i><span class="txt">'+txt+'</span>';
        load_tips += '</div><div id="data-progress-load" class="pop-mask"></div>';
        $('body').append(load_tips);
    };
    //移除正在处理提示
    var removeLoad = function(){
        $(".data-progressing").remove();
        $("#data-progress-load").remove();
    };
    return {
        popup:popup,
        popupSlide:popupSlide,
        alertPopup:alertPopup,
        loadPopup:loadPopup,
        removeLoad:removeLoad
    };
})